// mod timer;

pub async fn fetch_data() -> String {
    tokio::time::sleep(std::time::Duration::from_secs(1)).await;
    "data".to_string()
}

#[cfg(test)]
mod tokio_test {
    use crate::tokio::fetch_data;

    #[tokio::test]
    async fn test_async() {
        let result = fetch_data().await;
        assert_eq!(result, "data");
    }

    #[tokio::test]
    async fn test_handle() {
        tokio::spawn(async {
            tokio::time::sleep(std::time::Duration::from_secs(1)).await;
            let h_1 = tokio::spawn(async {
                tokio::time::sleep(std::time::Duration::from_secs(1)).await;
            });

            let _ = h_1.await;

            // let h_done = h_1.is_finished();

            "data".to_string()
        });
    }
}
